<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

use App\Http\Resources\FreeCarCollection;
use App\FreeCar;

//Route::apiResource('freeCar', 'FreeCarController');
Route::middleware('cors')->group(function (){
Route::apiResources([
    'freeCar' => 'FreeCarController',
    'specialCar' => 'SpecialCarController',
    'station' => 'StationController']);
});
//Route::get('/freeCars', function () {
//    return new FreeCarCollection(FreeCar::paginate());
//});
//Route::get('/freeCar/{id}', function ($id){
//    return new FreeCarResource(FreeCar::find($id));
//});
